﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Heavysoft.Mince.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Добро пожаловать в ASP.NET MVC!";

            string systemInfo = "";
            foreach (var property in typeof(Environment).GetProperties())
            {
                systemInfo += property.Name + " = " + property.GetValue(null, null) + "<br/>";
            }
            ViewData["SystemInfo"] = systemInfo;

            Npgsql.NpgsqlConnection con = new Npgsql.NpgsqlConnection("Server=192.168.0.12;Port=5432;User Id=mince;Password=Mince01;Database=mincedb");
            con.Open();

            Npgsql.NpgsqlCommand cmd = new Npgsql.NpgsqlCommand("select version()", con);
            ViewData["PostgresVersion"] = cmd.ExecuteScalar();

            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
